package com.zhangtai.modules.service.security;


import com.zhangtai.modules.dto.SecurityDto;
import com.zhangtai.modules.entity.security.SecurityEntity;
import com.zhangtai.utils.PageResult;
import com.zhangtai.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;


/**
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-08-17 17:30:20
 */

public interface SecurityService {

    @GetMapping("/findSecurityList")
    @ApiOperation(value = "分页查询")
    PageResult queryPage(@RequestParam(value = "keyword", required = false) String keyword,
                         @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                         @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize);

    PageResult getPersonSecurity(@RequestParam(value = "oid", required = false) Long oid,
                                 @RequestParam(value = "type", required = false) Integer type,
                                 @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize);

    @GetMapping("/infoSecurity")
    @ApiOperation(value = "根据id查找")
    SecurityEntity getByIdE(@RequestParam("id") Long id);


    PageResult<SecurityEntity> getSecurityList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                               @RequestParam(value = "securityName", required = false) String securityName,
                                               @RequestParam(value = "unitName", required = false) String unitName,
                                               @RequestParam(value = "cityName", required = false) String cityName,
                                               @RequestParam(value = "status", required = false) Integer status,
                                               @RequestParam(value = "number", required = false) Long number,
                                               @RequestParam(value = "type", required = false) Integer type);


    PageResult<SecurityDto> getSecurityList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                            @RequestParam(value = "contractIds") List<Long> contractIds,
                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                            @RequestParam(value = "securityName", required = false) String securityName,
                                            @RequestParam(value = "unitName", required = false) String unitName,
                                            @RequestParam(value = "cityName", required = false) String cityName,
                                            @RequestParam(value = "status", required = false) Integer status,
                                            @RequestParam(value = "number", required = false) Long number,
                                            @RequestParam(value = "type", required = false) Integer type,
                                            @RequestParam(value = "startTime", required = false) String startTime,
                                            @RequestParam(value = "endTime", required = false) String endTime);

    List<SecurityEntity> getAllSecurityList(@RequestParam(value = "type", required = false) Integer type);

    SecurityEntity getByUnitName(String unitName, Integer type);

    @PostMapping("/saveSecurity")
    @ApiOperation(value = "保存")
    R saveE(@RequestBody SecurityEntity entity);

    @PostMapping("/updateSecurity")
    @ApiOperation(value = "修改")
    R updateByIdE(@RequestBody SecurityEntity entity);

    @GetMapping("/deleteOneSecurity")
    @ApiOperation(value = "根据ID删除")
    R removeOneById(@RequestParam("id") Long id);

    @PostMapping("/deleteSecuritys")
    @ApiOperation(value = "根据ID集合删除")
    R removeByIdsE(@RequestBody List<Long> ids);
}

